<?php

/**
 * Gerencia os menus do site de forma simples.
 * Pode-se pensar em extender o uso por colocar os menus no banco de dados 
 * e fazer a interface PHP para o Smarty.
 * @author heekinho
 */
class Menu {
	var $title = '';
	var $minlevel = 0;
	var $items = array();
	
	/**
	 * Contrói o objeto Menu.
	 * @author heekinho
	 * @return Menu
	 */
	public function Menu($title = 'menu', $minlevel = 0) {
		$this->title = $title;
		$this->minlevel = $minlevel;
	}
	
	
	/**
	 * Insere um item de menu.
	 * @author heekinho
	 * @param MenuItem $menu_item
	 */
	public function push_menu_item(&$menu_item){
		array_push($this->items, $menu_item);
	}
}



/**
 * Item de Menu.
 * @author heekinho
 */
class MenuItem {
	var $name;
	var $url;
	var $image;
	
	/**
	 * Constrói um submenu.
	 * @author heekinho
	 */
	var $submenu = false;
	
	/**
	 * Define o nível mínimo de privilégio que o usuário deve ter para ser mostrado.
	 * @author heekinho
	 */
	var $minlevel = 0;
	
	
	/**
	 * Contrói Items de Menu.
	 * @author heekinho
	 * @param string $name
	 * @param string $url
	 * @param string $image
	 * @return MenuItem
	 */
	public function MenuItem($name, $url, $image, $level = 0){
		$this->name = $name;
		$this->url = $url;
		$this->image = $image;
	}
	
	/**
	 * Atribui um submenu ao item de menu.
	 * @author heekinho
	 * @param Menu $menu
	 */
	public function set_submenu(&$menu){
		$this->submenu = $menu;
	}
}


/**
 * Teste para armazenar os Menus.
 * @author heekinho
 */
class Menus {
	var $aluno_menu = array();
	var $admin_menu = array();
	var $prof_menu = array();
	
	var $user_menu;
	var $main_menu;
	var $footer_menu;
	
	public function Menus(){
		global $site, $user;
		
		$this->main_menu = new Menu('Menu Principal');
		$this->main_menu->push_menu_item(new MenuItem('Página Principal', $site->base_url, $site->image_path . 'house.png'));
		$this->main_menu->push_menu_item(new MenuItem('Contato', $site->base_url.'p/escore.php', $site->image_path . 'email.png'));
		$this->main_menu->push_menu_item(new MenuItem('Desenvolvedores', $site->base_url.'p/escore.php', $site->image_path . 'user_gray.png'));
		$this->main_menu->push_menu_item(new MenuItem('O Sistema', $site->base_url.'p/escore.php', $site->image_path . 'info.png'));
		
		$this->user_menu = new Menu('Menu de Usuário');
		$this->user_menu->push_menu_item(new MenuItem('Usuário: '.$user->username, '#', $site->image_path . 'status_online.png'));
		$this->user_menu->push_menu_item(new MenuItem('Logout', $site->base_url.'members/logout.php', $site->image_path . 'status_offline.png'));
		
		
		$this->aluno_menu = new Menu('Menu do Aluno');
		$this->aluno_menu->push_menu_item(new MenuItem('Histórico', $site->base_url.'p/escore.php', $site->image_path . 'bullet.png'));
		$this->aluno_menu->push_menu_item(new MenuItem('Escore', $site->base_url.'p/escore.php', $site->image_path . 'bullet.png'));
		$this->aluno_menu->push_menu_item(new MenuItem('Semestralização', $site->base_url.'p/escore.php', $site->image_path . 'bullet.png'));
		
		
		$item_prematricula = new MenuItem('Pré-Matrícula', $site->base_url.'p/escore.php', $site->image_path . 'bullet.png');
		$menu_prematricula = new Menu('Pré Matrícula');
		$menu_prematricula->push_menu_item(new MenuItem('teste', '#', ''));
		$item_prematricula->set_submenu($menu_prematricula);
		$this->aluno_menu->push_menu_item($item_prematricula);
		
			

		$this->aluno_menu->push_menu_item(new MenuItem('Matrícula', $site->base_url.'p/escore.php', $site->image_path . 'bullet.png'));
		
		
//		array_push($this->prof_menu, array_combine($titles, array('Disciplina', $site->base_url.'p/escore.php', $site->image_path . 'bullet.png')));
//		array_push($this->prof_menu, array_combine($titles, array('Carga Horária', $site->base_url.'p/escore.php', $site->image_path . 'bullet.png')));
//		array_push($this->prof_menu, array_combine($titles, array('Notificações', $site->base_url.'p/escore.php', $site->image_path . 'bullet.png')));
//
//		
//		array_push($this->admin_menu, array_combine($titles, array('Listar Alunos', $site->base_url.'admin/escore.php', $site->image_path . 'bullet.png')));
//		array_push($this->admin_menu, array_combine($titles, array('Escore', $site->base_url.'p/escore.php', $site->image_path . 'bullet.png')));
//		array_push($this->admin_menu, array_combine($titles, array('Semestralização', $site->base_url.'p/escore.php', $site->image_path . 'bullet.png')));
//		array_push($this->admin_menu, array_combine($titles, array('Pré-Matrícula', $site->base_url.'p/escore.php', $site->image_path . 'bullet.png')));
//		array_push($this->admin_menu, array_combine($titles, array('Matrícula', $site->base_url.'p/escore.php', $site->image_path . 'bullet.png')));
//		array_push($this->admin_menu, array_combine($titles, array('Projeto Anual', $site->base_url.'p/escore.php', $site->image_path . 'bullet.png')));
//		array_push($this->admin_menu, array_combine($titles, array('Oferta Semestral', $site->base_url.'p/escore.php', $site->image_path . 'bullet.png')));
//		array_push($this->admin_menu, array_combine($titles, array('Histórico', $site->base_url.'p/escore.php', $site->image_path . 'bullet.png')));
	}
}

?>
